import Vue from "vue";

import VeeValidate from "vee-validate";
//引入国际化文件
import zh_CN from "vee-validate/dist/locale/zh_CN"; // 引入中文 message
//安装插件:提供一个全局的自定义指令v-validate,可以进行表单校验
Vue.use(VeeValidate);

//国际化设置
VeeValidate.Validator.localize("zh_CN", {
  messages: {
    ...zh_CN.messages,
    is: (field) => `${field}必须与密码相同`, //确认密码愚密码相同
  },
  attributes: {
    phone: "手机号",
  },
});

//复选框自定义消炎规则
VeeValidate.Validator.extend("agree", {
  validate: (value) => {
    return value;
  },
  getMessage: (field) => field + "必须同意",
});
